草庐IT

php - 谷歌 API : 404 Domain not found

全部标签

javascript - 如何从 Rails View 调用内部 API(用于 ReactJS 预渲染目的)?

我已经有了返回JSON响应的RailsAPIController。前端Javascript(以及移动应用程序)使用它来呈现值。现在,我希望使用ReactJS预呈现这些值:#app/controllers/api/v1/products_controller.rbmoduleAPImoduleV1classProductsController如何有效调用内部/api/v1/products和/api/v1/userURL(例如,不向我自己的服务器发出HTTPGET请求)? 最佳答案 我同意您希望为您的View重用您的API代码。这将使

javascript - angular-in-memory-web-api : ctorParameters. 映射不是函数

我正在使用Angular2In-MemroryAPI的0.1.17以及AngularCLI(带有Webpack)。我逐字按照HTTPtutorial中的所有步骤进行操作我收到以下错误:reflection_capabilities.js:58UncaughtTypeError:ctorParameters.mapisnotafunctionatReflectionCapabilities.parameters(http://localhost:4200/main.bundle.js:48626:45)这是我的app.module.js导入:imports:[BrowserModule,

javascript - 在谷歌地图javascript下拍摄特定区域的快照

我正在尝试拍摄由在谷歌地图上绘制的矩形包围的区域的快照。是否可以拍摄矩形下方区域的快照?我搜索了答案,但找不到任何有用的信息。Rectangledrawnonthemap我尝试通过指定map中心、缩放级别、图像宽度和图像高度,使用静态mapAPI拍摄矩形下方区域的快照。像https://maps.googleapis.com/maps/api/staticmap?center=CENTEROFTHERECTANGLE&zoom=ZOOMLEVELOFTHEMAP&size=WIDTHANDHEIGHTOFTHERECTANGLE&maptype=satellite&key=APIKEY

javascript - new URL() - WHATWG URL API

我正在摆弄Node,我正在尝试获取URL类的实例(因为那些方便的属性)。喜欢:const{URL}=require('url');(...)http.createServer((request,response)=>{leturi=newURL(request.url);(...)}但是失败了TypeError[ERR_INVALID_URL]:InvalidURL:/这很有趣,因为consturl=require('url');url.parse();有效。所以我对此很好奇。我了解后一种方法较旧。我在本地进行开发,因此要在浏览器中使用localhost:8000发送请求。如何使用re

javascript - 如何模拟在使用 Jest 测试的 React 组件中进行的 API 调用

我正在尝试模拟一个将数据检索到组件中的fetch()。I'musingthisasamodelformockingmyfetches,但我无法让它正常工作。我在运行测试时遇到此错误:babel-plugin-jest-hoist:Themodulefactoryof'jest.mock()'isnotallowedtoreferenceanyout-of-scopevariables。有没有办法让这些函数返回模拟数据,而不是实际尝试进行真正的API调用?代码utils/getUsers.js返回Angular色映射到每个用户的用户。constgetUsersWithRoles=role

javascript - 轴 #0 的数据列不能是谷歌图表仪表板中的字符串类型

这个问题在这里已经有了答案:Datacolumn(s)foraxis#0cannotbeoftypestringerroringooglechart(6个答案)关闭6年前。我正在尝试制作一个谷歌图表仪表板并尝试了以下代码:GoogleVisualizationAPISamplegoogle.load('visualization','1.1',{packages:['controls']});functiondrawVisualization(){varlistOfValues=document.getElementById("id1").value;vartemp2=null;var

javascript - jsonp 在调用 Redmine API 时得到 404

我正在尝试使用angularjs项目中的RedmineAPI。我最终使用jsonp来解决CORS问题。我在调用时收到404:varurl='http://muser:mpasswd@myredmine/issues.json?callback=displayIssues';$http({method:'JSONP',url:url}).success(function(data,status){console.log("success");console.log(data);}).error(function(data,status){console.log("Error:"+stat

javascript - 无法使用 fetch api 发送 DELETE 请求

当我向某个端点发送删除请求时,例如httpie从像这样的终端http删除http://localhost:8181/admin/applications/uspecs我得到一个有效的行为,如{success:true}作为响应主体。但是当我这样做的时候fetch('http://localhost:8181/admin/applications/uspecs',{method:'DELETE'}).then(res=>doSomethingWithResponse()).catch(err=>console.error(err))在javascript代码中,我得到一个FetchAPI

javascript - 对于 Angular 谷歌地图,我如何删除多段线?

对于Angular谷歌地图,我该如何删除多段线?我在使用templateUrl的指令中使用带有JavaScript的Angular版本1。版本:angular-google-maps2.1.5这是我当前的HTML:这是我需要删除的绘制折线的img:到目前为止,我已经通过点击我的清除map按钮尝试了这个:scope.polygonConfig.events.setMap(null);但我随后收到此控制台错误:“无法读取未定义的属性‘setMap’”我也试过这个:uiGmapIsReady.promise(1).then(function(instances){constmap=insta

javascript - Angular 和 Observable : how to avoid multiple requests to API within a given time

我在Angular4应用程序中有类似的东西(为了示例,我删除了代码)@Injectable()exportclassSomeService{constructor(privatehttp:Http){}get(id:number){returnthis.http.get('http://somedomain/somemodel/${id}.json');}}一些组件使用它来进行API调用。constructor(privatesomeService:SomeService){}...someMethod(){//codehere...this.someService.get(2).su